
//map为类似<Key, Value>类型的映射表。
var map = new Map()

//站点管理
map.set("standsideList", () => import('@/views/Standside/StandsideList'))//站点信息
map.set("modellist", () => import('@/views/Model/modellist')) //站点类型

//温度管理
map.set("standside3d", () => import('@/views/Standside/Standside3D'))
map.set("curves", () => import('@/views/Standside/curves'))
map.set("temperature", () => import('@/views/Standside/Temperature'))

//换电站告警
map.set("warning", () => import('@/views/Warning/Warning'))
map.set("warnInfo", () => import('@/views/Warning/warnInfo'))
map.set("workorder", () => import('@/views/Order/order'))

//数据字典管理
map.set("monthlist", () => import('@/views/Information/monthlist'))

//故障分析
map.set("fault", () => import('@/views/Fault/fault'))

//系统管理
map.set("staffinfo", () => import('@/views/Staffinfo/staffinfo'))
map.set("actor", () => import('@/views/Actor/actor'))
map.set("account", () => import('@/views/Account/Account.vue'))
map.set("power", () => import('@/views/Power/power'))
map.set("datadict", () => import('@/views/Datadict/datadict'))
map.set("log", () => import('@/views/Log/log'))


//处理动态路由方法
function getRouterList(userRouter) {
    const routes = [
        {
          path: "/login", //登录
          name: "login",
          hidden: true,
          component: () => import("@/views/Login/Login"),
        },
        {
          path: "/404", //404
          name: "error",
          hidden: true,
          component: () => import("@/views/Notfound/404"),
        },
        {
          path: "/",//父级别路由
          name: "index",
          redirect: "/home",
          component: () => import("@/components/index"),
          hidden: true,
          children: [
            {
              path: "/home", //首页 子级别路由
              name: "home",
              hidden: false,
              component: () => import('@/views/Home/home')
            },
          ],
        },
      ];
    userRouter.map((item) => {
        item.component = map.get(item.component)//通过映射找到我们定义好的组件
        routes[2].children.push(item)
    })
    return routes
}
export default {
    getRouterList
}